<template>
  <div class="toast">
    <i
      :class="
        toastType == 'success'
          ? 'iconfont icon-toast_chenggong'
          : toastType == 'danger'
          ? 'iconfont icon-toast-shibai_huaban'
          : 'iconfont icon-toast-jinggao'
      "
    ></i>
    <span>{{ toastMsg }}</span>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState({
      toastMsg: (state) => state.toastStatus.toastMsg,
      toastType: (state) => state.toastStatus.toastType,
    }),
  },
};
</script>
 
<style lang = "less" scoped>
.toast {
  position: fixed;
  left: 50%;
  /* top: 0; */
  transform: translateX(-50%);
  height: 45px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background-color: #fff;
  box-shadow: 0 0 10px #333;
  border-radius: 6px;
  z-index: 9999;
  .iconfont {
    margin-right: 5px;
  }

  .icon-toast-shibai_huaban {
    color: red;
  }

  .icon-toast_chenggong {
    color: green;
  }
  .icon-toast-jinggao {
    color: orange;
  }
}
</style>